package com.ming.mingbase.base.util;

import java.io.Serializable;

/**
 * 分页信息对象
 * @author Administrator
 *
 */
public class Page implements Serializable{

	private static final long serialVersionUID = 1L;
	private int itemCount;//总数
	private int pageCount;//总页数
	private int pageSize;//每页显示数量
	private int currentPage;//当前页
	private int itemStart;//开始位
	private int itemEnd;//结束位
    private Object pageData;

	public Page(){
		pageSize=10;
		currentPage=1;
	}

	public int getItemCount() {
		return itemCount;
	}
	public void setItemCount(int itmeCount) {
		this.itemCount = itmeCount;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getCurrentPage() {
		if(currentPage<1){
			currentPage=1;
		}
		return currentPage;
	}
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	/**
	 *  总页数
	 * @return
	 */
	public int getPageCount() {
		//99  10  100/10   总条数/每页的数量
		return itemCount%pageSize==0?itemCount/pageSize:(itemCount/pageSize+1);
	}
	public int getItemStart() {
		return (getCurrentPage() - 1) * pageSize;
	}
	public int getItemEnd() {
		return getItemStart()+pageSize;
	}

	public Object getPageData() {
		return pageData;
	}

	public void setPageData(Object pageData) {
		this.pageData = pageData;
	}




}

